package cn.iocoder.yudao.module.trade.service.brokerage;

import cn.iocoder.yudao.module.trade.dal.dataobject.brokerage.BrokerageUserStoreDO;
import cn.iocoder.yudao.module.trade.dal.mysql.brokerage.BrokerageUserStoreMapper;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;

import java.util.List;
import java.util.Map;
import java.util.Set;

import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMap;

/**
 * 分销用户-店铺 Service 实现类
 *
 * @author e3
 * @date 2025/03/15
 */
@Service
@Validated
public class BrokerageUserStoreServiceImpl implements BrokerageUserStoreService {

    @Resource
    private BrokerageUserStoreMapper brokerageUserStoreMapper;

    @Override
    public Map<Long, BrokerageUserStoreDO> getBrokerageUserStoreMapByUserId(Set<Long> brokerageUserIds) {
        List<BrokerageUserStoreDO> list = brokerageUserStoreMapper.selectList(BrokerageUserStoreDO::getBrokerageUserId, brokerageUserIds);
        return convertMap(list, BrokerageUserStoreDO::getBrokerageUserId);
    }

    @Override
    public List<BrokerageUserStoreDO> getBrokerageUserStore(Long brokerageUserId) {
        return brokerageUserStoreMapper.selectList(BrokerageUserStoreDO::getBrokerageUserId, brokerageUserId);
    }
}
